/*	Example: survey_restricted.do using survey.dta */
local folder "C:\Users\mlevere\OneDrive - Mathematica\Documents\Projects\Nepal\"

clear all

set more 1

/*	Higher memory might be necessary for larger datasets */

set memory 2000m

/* Indicate to the Stata compiler where the igrowup_restricted.ado file is stored*/
adopath + "`folder'/Programs/igrowup_stata"


/* Load the data file */
use "`folder'/Data/follow_up_raw_child", clear


/* generate the first three parameters reflib, datalib & datalab	*/
gen str100 reflib="`folder'/Programs/igrowup_stata"
lab var reflib "Directory of reference tables"

gen str100 datalib="`folder'/Data/"
lab var datalib "Directory for datafiles"

gen str30 datalab="follow_up_raw_child"
lab var datalab "Working file"


/*	check the variable for "sex"	1 = male, 2=female */
desc child_sex
tab child_sex


/*	check the variable for "age"	*/
desc child_tot_months
summ child_tot_months


/*	define your ageunit	*/
gen str6 ageunit="months"				/* or gen ageunit="days" */
lab var ageunit "=days or =months"


/*	check the variable for body "weight" which must be in kilograms*/
/* 	NOTE: if not available, please create as [gen weight=.]*/
replace child_weight = . if child_weight == 999
desc child_weight 
summ child_weight

/* 	check the variable for "height" which must be in centimeters	*/ 
/* 	NOTE: if not available, please create as [gen height=.]*/
replace child_height = . if child_height == 999
desc child_height 
summ child_height


/*	check the variable for "measure"*/
/* 	NOTE: if not available, please create as [gen str1 measure=" "]*/
gen measure = "l" if child_height_laying == 1
replace measure = "h" if child_height_laying == 2
desc measure
tab measure

/* 	check the variable for "oedema"*/
/* 	NOTE: if not available, please create as [gen str1 oedema="n"]*/
gen str1 oedema = "n"
desc oedema
tab oedema


/*	check the variable for "sw" for the sampling weight*/
/* 	NOTE: if not available, please create as [gen sw=1]*/
gen sw = 1
desc sw
summ sw

/* 	Fill in the macro parameters to run the command */
igrowup_restricted reflib datalib datalab child_sex child_tot_months ageunit child_weight child_height measure oedema sw

